/**
 * 在顶部展示某些组件
 */
export default function showInHeader(arr) {
	return function (target) {
		const { componentWillMount, componentWillUnmount } = target.prototype;
		target.prototype.componentWillMount = function () {
			const { dispatch } = this.props;
			if (componentWillMount) componentWillMount.call(this);
			dispatch({
				type: 'app/showInHeader',
				showInHeader: arr
			});
		};
		target.prototype.componentWillUnmount = function () {
			const { dispatch } = this.props;
			if (componentWillUnmount) componentWillUnmount.call(this);
			dispatch({
				type: 'app/showInHeader',
				showInHeader: []
			});
		};
	};
}
